
#include <string>
#include <vector>

class Util
{
public:
    static void CutString(std::string s, const std::string &sep, std::vector<std::string> *out)
    {
        // aaaa\r\nbbbbb\r\nccc\r\n\r\n
        std::size_t start = 0;
        while (start < s.size())
        {
            std::size_t pos = s.find(sep, start);
            if (pos == s.npos)
                break;

            std::string sub = s.substr(start, pos - start);
            out->push_back(sub);
            start += sub.size();
            start += sep.size();
        }
        if (start < s.npos)
            out->push_back(s.substr(start));
    }
};
